home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 4
/
Aminet 4 - November 1994.iso
/
aminet
/
util
/
gnu
/
gnuplot_3_5.lha
/
gnuplot
/
termcorel.trm
< prev
next >
Wrap
Text File
|
1993-09-16
|
11KB
|
345 lines
/*
* $Id: corel.trm%v 3.50 1993/07/09 05:35:24 woo Exp $
*/
/*
corel.trm
A modified ai.trm for CorelDraw import filters
by Chris Parks, parks@physics.purdue.edu
Import from CorelDraw with the CorelTrace filter
syntax: set terminal default
set terminal mode "fontname" fontsize,xsize,ysize,linewidth
mode= color or monochrome (default=mono)
"fontname"= postscript font name (default="SwitzerlandLight")
fontsize = size of font in points (default=22pt)
xsize = width of page in inches (default=8.2in)
ysize = height of page in inches (default=10in)
linewidth = width of lines in points (default=1.2pt)
*/
/* plots for publication should be sans-serif (don't use TimesRoman) */
char corel_font[MAX_ID_LEN+1] = "SwitzerlandLight" ; /* name of font */
int corel_fontsize = 22; /* size of font in pts */
TBOOLEAN corel_color = FALSE;
TBOOLEAN corel_stroke = FALSE;
int corel_path_count=0; /* count of lines in path */
int corel_ang=0; /* text angle */
enum JUSTIFY corel_justify=LEFT; /* text is flush left */
/* default mode constants */
#define CORELD_XOFF 0 /* page offset in pts */
#define CORELD_YOFF 0
#define COREL_SC (10.0) /* scale is 1pt = 10 units */
#define CORELD_LW (1.2*COREL_SC) /* linewidth = 1.2 pts */
#define CORELD_XMAX 5960 /* 8.2 inches wide */
#define CORELD_YMAX 7200 /* 10 inches high */
#define CORELD_VTIC (CORELD_YMAX/80)
#define CORELD_HTIC (CORELD_YMAX/80)
#define CORELD_VCHAR (22*COREL_SC) /* default is 22 point characters */
#define CORELD_HCHAR (22*COREL_SC*6/10)
unsigned int corel_xmax=CORELD_XMAX;
unsigned int corel_ymax=CORELD_YMAX;
float corel_lw=CORELD_LW;
COREL_options()
{
extern struct value *const_express();
extern double real();
struct value a;
if (!END_OF_COMMAND && almost_equals(c_token,"def$ault")) {
corel_color=FALSE;
strcpy(corel_font,"SwitzerlandLight");
corel_fontsize = 22;
corel_lw=CORELD_LW;
corel_xmax=CORELD_XMAX;
corel_ymax=CORELD_YMAX;
c_token++;
}
if (!END_OF_COMMAND && almost_equals(c_token,"mono$chrome")) {
corel_color=FALSE;
c_token++;
} else
if (!END_OF_COMMAND && almost_equals(c_token,"color$")) {
corel_color=TRUE;
c_token++;
}
if (!END_OF_COMMAND && isstring(c_token)) {
quote_str(corel_font,c_token);
c_token++;
}
if (!END_OF_COMMAND) {
/* We have font size specified */
corel_fontsize = (int)real(const_express(&a));
c_token++;
term_tbl[term].v_char = (unsigned int)(corel_fontsize*COREL_SC);
term_tbl[term].h_char = (unsigned int)(corel_fontsize*COREL_SC*6/10);
}
if (!END_OF_COMMAND) {
corel_xmax=(unsigned int)(real(const_express(&a))*720);
c_token++;
if (!END_OF_COMMAND) {
corel_ymax=(unsigned int)(real(const_express(&a))*720);
c_token++;
}
term_tbl[term].xmax=corel_xmax;
term_tbl[term].ymax=corel_ymax;
term_tbl[term].v_tic=corel_ymax/80;
term_tbl[term].h_tic=corel_ymax/80;
}
if (!END_OF_COMMAND) {
corel_lw= real(const_express(&a))*COREL_SC;
c_token++;
}
sprintf(term_options,"%s \"%s\" %d,%0.1f,%0.1f,%0.1f",
corel_color ? "color" : "monochrome",corel_font,
corel_fontsize,corel_xmax/720.0,corel_ymax/720.0,
corel_lw/COREL_SC);
}
COREL_init()
{
fprintf(outfile,"%%!PS-Adobe-2.0 EPSF-1.2\n");
fprintf(outfile,"%%%%BoundingBox: %d %d %d %d\n", CORELD_XOFF,CORELD_YOFF,
(int)((corel_xmax)/COREL_SC+0.5+CORELD_XOFF),
(int)((corel_ymax)/COREL_SC+0.5+CORELD_YOFF) );
fprintf(outfile,"%%%%TemplateBox: %d %d %d %d\n", CORELD_XOFF,CORELD_YOFF,
(int)((corel_xmax)/COREL_SC+0.5+CORELD_XOFF),
(int)((corel_ymax)/COREL_SC+0.5+CORELD_YOFF) );
fprintf(outfile,"%%%%EndComments\n");
fprintf(outfile,"%%%%EndProlog\n");
fprintf(outfile,"%%%%BeginSetup\n%%%%EndSetup\n");
}
COREL_graphics()
{
corel_path_count = 0;
corel_stroke = FALSE;
}
COREL_text()
{
if (corel_stroke) {
fprintf(outfile,"S\n");
corel_stroke = FALSE;
}
corel_path_count = 0;
}
COREL_reset()
{
fprintf(outfile,"%%%%Trailer\n");
}
COREL_linetype(linetype)
int linetype;
{
if (corel_stroke) {
fprintf(outfile,"S\n");
corel_stroke = FALSE;
}
switch(linetype) {
case -2 : fprintf(outfile,"%.2f w\n",corel_lw/COREL_SC);
if (corel_color) {
fprintf(outfile,"0 0 0 1 K\n");
}
else {
fprintf(outfile,"[] 0 d\n");
fprintf(outfile,"0 j\n0 G\n");
}
break;
case -1 : fprintf(outfile,"%.2f w\n",corel_lw/COREL_SC);
if (corel_color) {
fprintf(outfile,"0 0 0 1 K\n");
}
else {
fprintf(outfile,"[1 2] 0 d\n");
fprintf(outfile,"0 j\n0 G\n");
}
break;
case 0 : fprintf(outfile,"%.2f w\n",corel_lw/COREL_SC);
if (corel_color) {
fprintf(outfile,"1 0 1 0 K\n");
}
else {
fprintf(outfile,"[] 0 d\n");
fprintf(outfile,"2 j\n0 G\n");
}
break;
case 1 : fprintf(outfile,"%.2f w\n",corel_lw/COREL_SC);
if (corel_color) {
fprintf(outfile,"1 1 0 0 K\n");
}
else {
fprintf(outfile,"[4 2] 0 d\n");
fprintf(outfile,"2 j\n0 G\n");
}
break;
case 2 : fprintf(outfile,"%.2f w\n",corel_lw/COREL_SC);
if (corel_color) {
fprintf(outfile,"0 1 1 0 K\n");
}
else {
fprintf(outfile,"[2 3] 0 d\n");
fprintf(outfile,"2 j\n0 G\n");
}
break;
case 3 : fprintf(outfile,"%.2f w\n",corel_lw/COREL_SC);
if (corel_color) {
fprintf(outfile,"0 1 0 0 K\n");
}
else {
fprintf(outfile,"[1 1.5] 0 d\n");
fprintf(outfile,"2 j\n0 G\n");
}
break;
case 4 : fprintf(outfile,"%f w\n",corel_lw/COREL_SC);
if (corel_color) {
fprintf(outfile,"1 0 0 0 K\n");
}
else {
fprintf(outfile,"[5 2 1 2] 0 d\n");
fprintf(outfile,"2 j\n0 G\n");
}
break;
case 5 : fprintf(outfile,"%.2f w\n",corel_lw/COREL_SC);
if (corel_color) {
fprintf(outfile,"0 0 1 0 K\n");
}
else {
fprintf(outfile,"[4 3 1 3] 0 d\n");
fprintf(outfile,"2 j\n0 G\n");
}
break;
case 6 : fprintf(outfile,"%.2f w\n",corel_lw/COREL_SC);
if (corel_color) {
fprintf(outfile,"0 0 0 1 K\n");
}
else {
fprintf(outfile,"[2 2 2 4] 0 d\n");
fprintf(outfile,"2 j\n0 G\n");
}
break;
case 7 : fprintf(outfile,"%.2f w\n",corel_lw/COREL_SC);
if (corel_color) {
fprintf(outfile,"0 0.7 1 0 K\n");
}
else {
fprintf(outfile,"[2 2 2 2 2 4] 0 d\n");
fprintf(outfile,"2 j\n0 G\n");
}
break;
case 8 : fprintf(outfile,"%.2f w\n",corel_lw/COREL_SC);
if (corel_color) {
fprintf(outfile,"0.5 0.5 0.5 0 K\n");
}
else {
fprintf(outfile,"[2 2 2 2 2 2 2 4] 0 d\n");
fprintf(outfile,"2 j\n0 G\n");
}
break;
}
corel_path_count = 0;
}
COREL_move(x,y)
unsigned int x,y;
{
if (corel_stroke) fprintf(outfile,"S\n");
fprintf(outfile,"%0.2f %0.2f m\n", x/COREL_SC, y/COREL_SC);
corel_path_count += 1;
corel_stroke = TRUE;
}
COREL_vector(x,y)
unsigned int x,y;
{
fprintf(outfile,"%.2f %.2f l\n", x/COREL_SC, y/COREL_SC);
corel_path_count += 1;
corel_stroke = TRUE;
if (corel_path_count >= 400) {
fprintf(outfile,"S\n%.2f %.2f m\n",x/COREL_SC,y/COREL_SC);
corel_path_count = 0;
}
}
COREL_put_text(x,y,str)
unsigned int x, y;
char *str;
{
char ch;
if (corel_stroke) {
fprintf(outfile,"S\n");
corel_stroke = FALSE;
}
switch(corel_justify) {
case LEFT : fprintf(outfile,"/_%s %d %d 0 0 z\n",
corel_font,corel_fontsize,corel_fontsize);
break;
case CENTRE : fprintf(outfile,"/_%s %d %d 0 1 z\n",
corel_font,corel_fontsize,corel_fontsize);
break;
case RIGHT : fprintf(outfile,"/_%s %d %d 0 2 z\n",
corel_font,corel_fontsize,corel_fontsize);
break;
}
if (corel_ang==0) {
fprintf(outfile,"[1 0 0 1 %.2f %.2f]e\n0 g\n",
x/COREL_SC,y/COREL_SC - corel_fontsize/3.0);
}
else {
fprintf(outfile,"[0 1 -1 0 %.2f %.2f]e\n0 g\n",
x/COREL_SC - corel_fontsize/3.0,y/COREL_SC);
}
putc('(',outfile);
ch = *str++;
while(ch!='\0') {
if ( (ch=='(') || (ch==')') || (ch=='\\') )
putc('\\',outfile);
putc(ch,outfile);
ch = *str++;
}
fprintf(outfile,")t\nT\n");
corel_path_count = 0;
}
int COREL_text_angle(ang)
int ang;
{
corel_ang=ang;
return TRUE;
}
int COREL_justify_text(mode)
enum JUSTIFY mode;
{
corel_justify=mode;
return TRUE;
}